package com.cat.chapter038;

/**
 * @author cat
 * @description
 * @create 2025/7/9 13:07
 * @since JDK17
 */

public class Solution08 {
    public static void hanno(int cur, String from, String to, String other) {
        if (cur == 1) {
            System.out.println("盘" + cur + "从" + from + "到" + to);
        } else {
            hanno(cur - 1, from, other, to);
            System.out.println("盘" + cur + "从" + from + "到" + to);
            hanno(cur - 1, other, to, from);
        }
    }

    public static void main(String[] args) {
        hanno(3, "A", "C", "B");
    }
}
